package cn.ingrun.utils.autoConfig;

import cn.ingrun.utils.auth.AuthServer;
import cn.ingrun.utils.auth.AuthServerImpl;
import cn.ingrun.utils.auth.LoginAuthAspect;
import cn.ingrun.utils.redisCache.aspect.RedisCache;
import cn.ingrun.utils.exceptionHandler.GlobalExceptionHandler;

import cn.ingrun.utils.redisCache.server.RedisCacheServer;
import cn.ingrun.utils.redisCache.server.RedisCacheServerImpl;
import cn.ingrun.utils.redisUtil.RedisUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AutoConfiguration {



    @Bean
    @ConditionalOnMissingBean(LoginAuthAspect.class)
    public LoginAuthAspect loginAuthAspect(){
        return new LoginAuthAspect();
    }

    @Bean
    @ConditionalOnMissingBean(RedisCache.class)
    public RedisCache redisCache(){
        return new RedisCache();
    }

    @Bean
    @ConditionalOnMissingBean(GlobalExceptionHandler.class)
    public GlobalExceptionHandler Global(){
        return new GlobalExceptionHandler();
    }

    @Bean
    @ConditionalOnMissingBean(RedisUtil.class)
    public RedisUtil redisUtil(){
        return new RedisUtil();
    }

    @Bean
    @ConditionalOnMissingBean(AuthServer.class)
    public AuthServer authServer(){
        return new AuthServerImpl();
    }

    @Bean
    @ConditionalOnMissingBean(RedisCacheServer.class)
    public RedisCacheServer redisCacheServer(){
        return new RedisCacheServerImpl();
    }

}
